package com.qys.livesMall.shop.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.QysPage;
import com.qys.livesMall.shop.modal.dto.CloseShopDto;
import com.qys.livesMall.shop.modal.dto.shop.*;
import com.qys.livesMall.shop.modal.dto.shop.contract.EditContract;
import com.qys.livesMall.shop.modal.entity.H2ShopBase;
import com.qys.livesMall.shop.modal.vo.AppShopVO;
import com.qys.livesMall.shop.modal.vo.ShopVO;

import java.math.BigDecimal;
import java.util.List;

/**
 * 用户小店(H2ShopBase)表服务接口
 *
 * @author makejava
 * @since 2023-05-26 10:29:44
 */
public interface H2ShopBaseService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    H2ShopBase queryById(Long id);

    AppShopVO queryByShopId(Long shopId);

    /**
     * 通过ID查询单条数据
     *
     * @param userId y用户编号
     * @return 实例对象
     */
    H2ShopBase queryShopBaseByUserId(Long userId);


    Long queryShopBaseIdByUserId(Long userId);

    AppShopVO getByApp();
    /**
     * 获取店铺
     * @return
     */
    ShopVO get();

    QysPage<H2ShopBase> search(ShopSearch search);

    /**
     * 分页查询
     *
     * @param search 筛选条件
     * @return 查询结果
     */
    QysPage<ShopVO> list(ShopSearch search);

    /**
     * app申请店铺
     * @param params
     * @return
     */
    R<Long> add(AppAddShop params,String ip);

    void addNavyShops(List<H2ShopBase> params);


    /**
     * 修改数据
     *
     * @param h2ShopBase 实例对象
     * @return 实例对象
     */
    R update(EditShop h2ShopBase);

    /**
     * 审核通过
     * @param id
     * @return
     */
    R auditPass(Long id);

    /**
     * 审核不通过
     * @param id
     * @return
     */
    R auditNoPass(Long id, String auditDesc);

    /**
     * 签订合同
     * @param contract
     * @return
     */
    R signContract(EditContract contract);

    /**申请关闭店铺*/
    R<CloseShopDto> closeShop(Long shopId);

    /**店铺闭店通过审批*/
    R<?> closeShopApprove(Long shopId);

    /**
     * 设置密码
     * @param password
     * @return
     */
    @Deprecated
    R setPasswordByApp(EditShopPassword password);

    R passwordStatus();


    /**
     * 存在店铺的用户集合
     * @param userIds
     * @return
     */
    List<Long> existShopByUserIds(List<Long> userIds);

    void upBatch(List<H2ShopBase> shopBases);

    /**
     * 设置店铺结算天数
     * @param shopBaseSettlementDay
     * @return
     */
    Boolean setShopSettlementDay(shopBaseSettlementDay shopBaseSettlementDay);

    /**
     * 店铺审核拒绝
     * @param shopId
     * @return
     */
    R auditRefuse(Long shopId);

    List<H2ShopBase> likeByShopName(String shopName);

    List<H2ShopBase> listByIds(List<Long> shopIds);

    boolean sendMessage(String phoneNumber);

    boolean sendMail(String mailNumber);

    BigDecimal getPayableEarnestMoney();

    BigDecimal getPayableEarnestMoney(Long shopId);
    /**
     * 缴纳保证金
     */
    void payEarnestMoney();

    List<Long> getShopIdByQuery(ShopQuery query);

    Boolean insufficientBalanceTip();

}
